<template>
  <div class="topic">
    <div class="find">
      <el-input placeholder="请输入内容"></el-input>
      <el-button size="small">查找</el-button>
      <el-button type="button"  @click="dialogTableVisible = true"  size="small">增加</el-button>
      <el-dialog title="添加文献" :visible.sync="dialogTableVisible">
        <el-form :model="form">
          <el-form-item label="题名" :label-width="formLabelWidth">
            <el-input v-model="form.name" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item label="年代" :label-width="formLabelWidth">
            <el-select v-model="value" placeholder="请选择" class="select_time">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="正文" :label-width="formLabelWidth">
            <el-upload
              class="upload-demo"
              :on-preview="handlePreview"
              action="192.168.157.129"
              :on-remove="handleRemove"
              :file-list="fileList">
              <el-button size="small">选择文件</el-button>
            </el-upload>
          </el-form-item>
          <el-form-item label="封面图片" :label-width="formLabelWidth">
            <el-upload
              class="upload-demo"
              :on-preview="handlePreview"
              action=""
              :on-remove="handleRemove"
              :file-list="fileList">
              <el-button size="small">选择文件</el-button>
            </el-upload>
          </el-form-item>
          <el-form-item label="正文图片" :label-width="formLabelWidth">
            <el-upload
              class="upload-demo"
              :on-preview="handlePreview"
              action=""
              :on-remove="handleRemove"
              :file-list="fileList">
              <el-button size="small">选择文件</el-button>
            </el-upload>
          </el-form-item>
          <el-form-item label="图文映射" :label-width="formLabelWidth">
            <el-upload
              class="upload-demo"
              :on-preview="handlePreview"
              action=""
              :on-remove="handleRemove"
              :file-list="fileList">
              <el-button size="small">选择文件</el-button>
            </el-upload>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogTableVisible = false">取消</el-button>
          <el-button type="primary" @click="dialogFormVisible = false">确定</el-button>
        </div>
      </el-dialog>
    </div>
      <el-table
        :data="rows"
        style="width: 100%">
        <el-table-column
          prop="login_name"
          label="文件名">
        </el-table-column>
        <el-table-column
          prop="user_type"
          label="文件类型">
        </el-table-column>
        <el-table-column
          prop="create_time"
          label="上传时间">
        </el-table-column>
        <el-table-column
          label="操作">
          <template scope="scope">
            <el-button type="text" size="small">查看</el-button>
            <el-button type="text" size="small">编辑</el-button>
          </template>
        </el-table-column>
      </el-table>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        fileList:[],
        options: [{
          value: '选项1',
          label: '唐'
        }, {
          value: '选项2',
          label: '宋'
        }, {
          value: '选项3',
          label: '元'
        }, {
          value: '选项4',
          label: '明'
        }, {
          value: '选项5',
          label: '清'
        }],
        value: '',
        dialogTableVisible: false,
        dialogFormVisible: false,
        form: {
          name: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: ''
        },
        formLabelWidth: '120px',
        "total": 10,
        "page": 0,
        "rows": [
          {
            "login_name": "123123123",
            "user_type": 1,
            "create_time": "2017-07-21 16:19:41",
            "user_name": "12312",
            "tel": "123132",
            "id": 1,
            "email": "12312"
          },
          {
            "login_name": "132131123",
            "user_type": 1,
            "create_time": "2017-07-21 16:19:52",
            "user_name": "21",
            "tel": "12312",
            "id": 2,
            "email": "12"
          },
          {
            "login_name": "123123121233",
            "user_type": 3,
            "create_time": "2017-07-21 16:32:07",
            "user_name": "12312",
            "tel": "12312",
            "id": 3,
            "email": "123"
          },
          {
            "login_name": "11333333333333333",
            "user_type": 1,
            "create_time": "2017-07-21 16:32:24",
            "user_name": "11",
            "tel": "11",
            "id": 5,
            "email": ""
          },
          {
            "login_name": "121412412",
            "user_type": 3,
            "create_time": "2017-07-21 16:32:36",
            "user_name": "31",
            "tel": "1",
            "id": 6,
            "email": "312"
          },
          {
            "login_name": "435432534",
            "user_type": 1,
            "create_time": "2017-07-21 16:32:44",
            "user_name": "3453",
            "tel": "34534",
            "id": 7,
            "email": "34534"
          },
          {
            "login_name": "42323412",
            "user_type": 1,
            "create_time": "2017-07-21 16:32:51",
            "user_name": "23423",
            "tel": "12312",
            "id": 8,
            "email": "131"
          },
          {
            "login_name": "453451231",
            "user_type": 1,
            "create_time": "2017-07-21 16:33:00",
            "user_name": "34534",
            "tel": "1231",
            "id": 9,
            "email": "12312"
          },
          {
            "login_name": "1235555555555",
            "user_type": 2,
            "create_time": "2017-07-21 17:56:03",
            "user_name": "123",
            "tel": "123",
            "id": 10,
            "email": "123"
          },
          {
            "login_name": "12312312312312",
            "user_type": 2,
            "create_time": "2017-07-24 13:12:16",
            "user_name": "12312312",
            "tel": "1231",
            "id": 11,
            "email": "123"
          }
        ]
      }
    },
    methods: {
      handleRemove(file, fileList) {
        console.log(file, fileList);
      },
      handlePreview(file) {
        console.log(file);
      }
    }
  }
</script>
<style>
  .topic{
    margin-top: 10px;
    margin-left: 10px;
  }
  .topic th{
    text-align: center;
  }
  .el-dialog__footer{
    overflow: auto;
  }
  .select_time .el-input{
    width:100% !important;
  }
</style>
